/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entities;

import java.awt.Rectangle;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.StateBasedGame;

/**
 *
 * @author Sincerelypwnd
 */
public class Entity {
    float x, y, width, height;
    Image image;
    Type type = Type.SQUARE;
    
    public enum Type {
        SQUARE, CIRCLE, TRIANGLE, PENTAGON, PROJECTILE
    }
    
    public Entity(float x, float y, String imgLocation) throws SlickException{
        this.x = x;
        this.y = y;
        this.image = new Image(imgLocation);
        this.height = this.image.getHeight(); this.width = this.image.getWidth();  
    }
    public boolean ColliededWith(Entity other){
        Rectangle myRect = new Rectangle((int)x,(int)y,(int)width,(int)height);
        Rectangle otherRect = new Rectangle((int)other.x,(int)other.y,(int)other.width,(int)other.height);
        if(myRect.intersects(otherRect)){
            return true;
        }else{
            return false;
        }
    }
    public void render(GameContainer container, StateBasedGame game, Graphics g) throws SlickException{
        g.drawImage(image, x, y);
    }
}
